/**
 * Depends:
 * widget.search.string.js
 */
$.fn.searchWidget = function(options){
	var $this = this;
	options = options || {};
	var searchStringSelector 	= options.searchStringSelector 		|| '#q';
	var paramsPanelSelector		= options.paramsPanelSelector 		|| '.params-search';
	var toggleButtonSelector	= options.toggleButtonSelector		|| '.advanced-search';
	var searchHelperSelector	= options.searchHelperSelector		|| '.insert-question';
	
	/**
	 * 
	 */
	$this._init = function(){
		$this.searchString = $(this).find(searchStringSelector).searchStringWidget();
		$this.paramsPanel  = $(this).find(paramsPanelSelector).searchParamsWidget();
/*		$this.toggleButton = $(this).find(toggleButtonSelector); */
		$this.searchHelper = $(this).find(searchHelperSelector);
	};
	
	/**
	 * 
	 */
	$this._bindEvents = function(){
		/* ----------------------------------------- */
		$this.searchHelper.click(function(){
			$this.searchString.val($(this).text());
			$this.searchString.focus();
			return  false;
		});
		/* ----------------------------------------- */
	};

	/**
	 * 
	 */
	$this.openPanel = function(){
		$this.paramsPanel.show();
	};
	
	/**
	 * 
	 */
	$this.closePanel = function(){
		$this.paramsPanel.hide();
	};
	
	/**
	 * Implementation
	 */
	$this._init();
	$this._bindEvents();
	
	return $(this);
};